// let rememberPassword = false
export const storage = {
    set(key: string, value: string) {
        // if (!rememberPassword) {
        //     rememberPassword = localStorage.getItem('rememberPassword') === 'true' ? true : false
        // }
        // rememberPassword ? localStorage.setItem(key, value) : sessionStorage.setItem(key, value)

        sessionStorage.setItem(key, value)
    },
    get(key: string) {
        // if (!rememberPassword) {
        //     rememberPassword = localStorage.getItem('rememberPassword') === 'true' ? true : false
        // }
        // return rememberPassword ? localStorage.getItem(key) ?? '' : sessionStorage.getItem(key) ?? ''

        return sessionStorage.getItem(key) ?? ''
    },
    remove(key: string) {
        // rememberPassword ? localStorage.removeItem(key) : sessionStorage.removeItem(key)

        sessionStorage.removeItem(key)
    },
    clear() {
        // if (rememberPassword) {
        //     for (let i = 0; i < localStorage.length; i++) {
        //         const key: string = localStorage.key(i) as string
        //         if (key !== 'propertyMap') {
        //             localStorage.removeItem(key)
        //         }
        //     }
        // } else {
        //     for (let i = 0; i < sessionStorage.length; i++) {
        //         const key: string = sessionStorage.key(i) as string
        //         if (key !== 'propertyMap') {
        //             sessionStorage.removeItem(key)
        //         }
        //     }
        // }

        sessionStorage.clear()
    }
}
